﻿using LineOfBusiness.Controls.Base;
using LineOfBusiness.Core.Base;
using LineOfBusiness.DataAccess;
using LineOfBusiness.Poco;
using LineOfBusiness.Poco.Custom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace LineOfBusiness.Controllers
{
    [PageAttribute(EntityChild = "SYS_FormLabels", EntityMater = "SYS_MaterLanguage")]
    public class FormLabelController : LOBController
    {
        //
        // GET: /FormLabel/

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Save(object Data)
        {
            SYS_MaterLanguage m = Data as SYS_MaterLanguage;
            using (EFDALContainer dal = new EFDALContainer())
            {
                try
                {
                    foreach (var item in m.SYS_FormLabels)
                    {
                        dal.Repository.AddOrUpdate(item);
                    }
                   
                    dal.UnitOfWork.SaveChanges();
                }
                catch (Exception exp)
                {
                    return Json(exp.Message);
                }
                return Json("0");
            }
        }
    }

   
}